package com.css.zfzx.fwsjcj.modules.statistics.user.vo;

import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.math.BigInteger;

/**
 * @Author leon
 * @Date: 2021/6/28 3:32 下午
 */
@Data
public class UserNumVo implements Comparable<UserNumVo> {
    @Excel(name = "省", width = 20)
    private String province;
    @Excel(name = "市", width = 25)
    private String city;
    @Excel(name = "区县", width = 25)
    private String area;

    @Excel(name = "数量", width = 25)
    private BigInteger number;
    private String divisionId;


    @Override
    public int compareTo(UserNumVo o) {
        String p1 = this.province;
        String p2 = o.getProvince();
        if (StringUtils.isEmpty(p1) && StringUtils.isNotEmpty(p2)) {
            return -1;
        } else if (StringUtils.isNotEmpty(p1) && StringUtils.isEmpty(p2)) {
            return 1;
        } else if (StringUtils.isEmpty(p1) && StringUtils.isEmpty(p2)) {
            return 0;
        } else {
            int flag = p1.compareTo(p2);
            if (flag == 0) {
                String c1 = this.city;
                String c2 = o.getCity();
                if (StringUtils.isNotEmpty(c1) && StringUtils.isNotEmpty(c2)) {
                    return c1.compareTo(c2);
                }
            }
            return flag;
        }
    }
}
